<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>拉萨市财政局投资评审管理系统  </title>
    <link rel="stylesheet" href="css/style.css">
    <script src="js/jquery-1.10.2.min.js"></script>
</head>
<body>
<!--main-header start-->
<div class="main-header">
    <div class="w-1200 clearfix">
        <div class="header-logo fl"><a href=""><img src="images/logo.png"></a> </div>
        <!--header-person start-->
        <div id="head_login"></div>
        <script type="text/javascript">
          
          $("#head_login").load("login_common.html");
        </script>
        <!--header-person end-->
        <!--header-nav start-->
        <div class="header-nav fr">
            <ul class="nav">
                <li><a href="/exptindex.html">待审核项目</a> </li>
                <li><a href="/exptindex2.html">已审核项目</a> </li>
                <span id="art"></span>
                <script>$("#art").load("artcommon.html")</script>
            </ul>
        </div>
        <!--header-nav end-->
    </div>
</div>
<!--main-header end-->
<!--scan-container start-->
<div class="scan-container w-1200" id="mainbox">
    <!--scan-step start-->
    <div class="scan-step clearfix">
        <div class="scan-step-hd fl">项目进度</div>
        <div class="scan-step-bd">
            <div class="step-num">
                <span class="circle">1</span>
                <p>资料准备</p>
            </div>
            <div class="step-num">
                <span class="circle">2</span>
                <p>预审中</p>
            </div>
            <div class="step-num">
                <span class="circle">3</span>
                <p>评审中</p>
            </div>
            <div class="step-num">
                <span class="circle">4</span>
                <p>复核中</p>
            </div>
            <div class="step-num">
                <span class="circle">5</span>
                <p>定审中</p>
            </div>
            <div class="step-num">
                <span class="circle">6</span>
                <p>完结</p>
            </div>
        </div>
    </div>
    <!--scan-step end-->
    <!--scan-main start-->
    <div class="scan-main">
        <!--scan-box start-->
        

      

        <div id="sm"></div>
        <script>$("#sm").load("common-iteminfo.html")</script>



        <!--scan-box end-->
        <!--scan-box start-->
        <div class="scan-box" id="filebox">
            <script>
                $("#filebox").load("filedetail.html");
            </script>
        </div>




        <!--scan-box end-->

    </div>
    <!--scan-main end-->
    <!--scan-main start-->
    <div id="reject"></div>




    <!--add-bottom end-->
    <!--驳回申请弹窗 start-->
    <link rel="stylesheet" href="js/alert/syalert.min.css">
    <script src="js/alert/syalert.min.js"></script>
    <div class="sy-alert scan-alert animated" sy-enter="zoomIn" sy-leave="zoomOut" sy-type="confirm" sy-mask="true" id="alert1">
        <div class="sy-title">
            请填写项目申请驳回理由
            <div class="scan-alert-close" onClick="syalert.syhide('alert1')"></div>
        </div>
        <div class="scan-alert-content">
            <textarea rows="6" class="txt"></textarea>
        </div>
        <div class="scan-alert-bot">
            <button class="login-btn" onClick="ok('alert1')">立即驳回</button>
        </div>
    </div>
    <script>
        function ok(id){
            syalert.syhide(id);
        }
    </script>
    <!--驳回申请弹窗 end-->
</div>
<!--scan-container end-->


<script src="js/auth.js"></script>
<!--scan-container end-->
<script type="text/javascript">
    
    var id=getQueryString("id");
    console.log(id);
    $.get(HTTP_HOST+"api/Jg/detail?id="+id,function(res){
    
            if (res.code == 200) {
                item = res.result.item;
                var index = getstat(item.status);
            $(".step-num").each(function(k,obj){
                if(k<=index){
                    $(obj).addClass("on");
                }  
            });
                    $("#xmbd").html(item.xmbd);
                    $("#xmlxr").html(item.contactor);
                    $("#address").html(item.address);
                    $("#name").html(item.name);
                    $("#type").html(item.type);
                    $("#owner").html(item.owner);
                    $("#industry").html(item.industry);
                    $("#lxwh").html(item.lxnumber);
                    $("#yjbh").html(item.yjbh);
    
                    $("#wtdw").html(item.wtdw);
                    $("#wtdwlxr").html(item.wtdwcontactor);
                    $("#wtdwlxrdh").html(item.wtdwcontactorphone);
                    $("#cash").html(item.cash);
                
                    var logs = res.result.log;

                   filllogs(logs);

                    if(item.status == 3){
                        var act=`<div class="scan-main">
        <!--scan-box start-->
        <div class="scan-box">
            <div class="scan-box-tit">专家小组最终意见</div>
            <div class="scan-opinion-text">
                <div class="text-bor">
                    <textarea rows="5" id="idea" placeholder="在此输入你对此次项目的具体评审意见"></textarea>
                </div>
            </div>
        </div>
        <!--scan-box end-->
    </div>
    <!--scan-main end-->



    



    
    <!--add-item start-->
        <div class="add-item">
            <div class="con w-full">
                <div class="input-w" style="width:1140px; margin: 0; ">
                    <div class="add-item-flex">
                        <div class="add-item-up">
                            <input type="file" multiple="multiple" class="add-item-up-file"   name="file[]" id="fileapprove" />
                            <span><img src="images/add2.png" ></span>
                        </div>
                        <div class="add-item-tip">
                            <p>1、可上传附件.</p>
                            <p>2、支持压缩包格式：rar、zip。</p>
                            <p>3、支持图片格式：jpeg、jpg、bmp、png。</p>
                            <p>4、支持办公文件格式：doc、docx、xls、xlsx、pdf、ppt。</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--add-item end-->
        <!--add-item-files start-->
        <div class="add-item-files" style="width:1100px; margin: 0; "  id="boxfiles">
           
        </div>
        <!--add-item-files end-->

    </div>












    <!--add-bottom start-->
    <div class="add-bottom mar0">
        <button class="login-btn" onclick="passitem(1)">审核通过</button>
        <button class="login-btn bor" onclick="passitem(0)">驳回申请</button>
    </div>`;

    $(".scan-container").append(act);
                    }

                }
    
    },'JSON');



    function passitem(res){
        var filebox = [];
        $(".fileapp").each(function(){
	var filepath = $(this).attr("value");
	var filename = $(this).attr("name");
    filebox.push({"filename":filename,"filepath":filepath});
   });

   if($("#idea").val() == ''){
       alert("请输入意见");
       return false;
   }
        $.post("/api/Jg/dealitem",{"id":id,"idea":$("#idea").val(),'appres':res,"files":filebox},function(res){
                if(res.result.code == 200){

                    alert("操作已成功");
                    location.reload();
                    
                }else{
                    alert(res.result.msg);
                }



        },'Json');




    }
    
    
    
    </script>

<script>



    $("#fileapprove").change(function(){
                //创建FormData对象
                var data = new FormData();
                //为FormData对象添加数据
                $.each($('#fileapprove')[0].files, function(i, file) {
                    data.append('upload_file'+i, file);
                });
    
               console.log(data);
    
                //发送数据
            $.ajax({
                    url:HTTP_HOST+'api/Index/upload',
                    type:'POST',
                    data:data,
                    cache: false,
                    contentType: false, //不可缺参数
                    processData: false,     //不可缺参数
                    success:function(data){
                        console.log(data);
                   var res = ""; 
                $.each(data.result,function(k,v){
                    res+= `<div class="add-item-files-span">`+k+`：`+v+`<span class="close" onclick="removefile(this)">X</span><input type='hidden' value=`+v+` name=`+k+` class='fileapp'>
                </div>`;	
    
                });
                  console.log(res);
                   $("#boxfiles").append(res);
    
                    },
                    error:function(){
                        alert('上传出错');
                        $(".loading").hide();   //加载失败移除加载图片
                    }
                });
            });
    
    
    
        </script>



</body>
</html>